<template>
  <div class="newsIfon-box">
      <h3>{{newsIfon.title}}</h3>
      <p>
        <span>发表时间:{{newsIfon.add_time | dateFormat}}</span>
        <span>点击:{{newsIfon.click}}次</span>
      </p>
      <hr>
      <div class="content" v-html="newsIfon.content"></div>
      <!-- <div class="content" >{{newsIfon.content}}</div> -->
      <comment :id='this.id'></comment>

    </div>
</template>
<script>
import comment from '../suncompoments/comment.vue'
import { toast } from "mint-ui";
export default {
  data() {
    return {
      id: this.$route.params.id,
      newsIfon: []
    };
  },
  created() {
    this.getnewsIfon();
  },
  methods: {
    getnewsIfon() {
      this.$http.get("api/getnew/" + this.id).then(res => {
        var res = res.body;
        if (res.status === 0) {
          this.newsIfon = res.message[0];
        } else {
          toast("获取失败");
        }
        console.log(this.newsIfon);
        
      });
    }
  },
  components:{
      comment
  }
};
</script>
<style lang="scss" scoped>
.newsIfon-box {
  padding: 0 5px;
  h3 {
    font-size: 16px;
    margin: 15px 0;
    color: red;
    text-align: center;
  }
  p {
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    color: #226aff;
  }
}
</style>